home *** CD-ROM | disk | FTP | other *** search
- stop();
- showScores = function()
- {
- var i = 5;
- while(i > 0)
- {
- var n = scoreboard_lv["name" + (page + i)];
- var s = scoreboard_lv["score" + (page + i)];
- var l_mc = this["line" + i + "_mc"];
- var lbg_mc = this["line" + i + "bg_mc"];
- l_mc.rank_txt.text = lbg_mc.rank_txt.text = page + i + ".";
- l_mc.name_txt.text = lbg_mc.name_txt.text = !n.length ? "-" : n.toUpperCase();
- l_mc.score_txt.text = lbg_mc.score_txt.text = !s.length ? "-" : s;
- l_mc._visible = lbg_mc._visible = true;
- loading_mc._visible = false;
- i--;
- }
- };
- loadScores = function(num)
- {
- next_btn._visible = back_btn._visible = slug_btn.enabled = worm_btn.enabled = python_btn.enabled = false;
- slug_mc._alpha = worm_mc._alpha = python_mc._alpha = 40;
- switch(num)
- {
- case 2:
- slug_mc._alpha = 100;
- break;
- case 1:
- worm_mc._alpha = 100;
- break;
- default:
- python_mc._alpha = 100;
- }
- var i = 5;
- while(i > 0)
- {
- this["line" + i + "_mc"]._visible = this["line" + i + "bg_mc"]._visible = false;
- i--;
- }
- loading_mc.gotoAndStop(1);
- loading_mc._visible = true;
- page = 0;
- maxScore = 100;
- scoreboard_lv = new LoadVars();
- if(score > 0 && game_so.data.playerName.length > 0)
- {
- scoreboard_lv.score = score;
- scoreboard_lv.name = game_so.data.playerName.toLowerCase();
- }
- scoreboard_lv.game = "snake" + (3 - num);
- scoreboard_lv.sendAndLoad("http://score.openwares.org/games_score_text.php",scoreboard_lv,"POST");
- scoreboard_lv.onLoad = function(success)
- {
- if(success)
- {
- if(Boolean(scoreboard_lv.success))
- {
- next_btn._visible = true;
- if(scoreboard_lv.maxScore.length > 0)
- {
- maxScore = Number(scoreboard_lv.maxScore);
- }
- showScores();
- }
- else
- {
- loading_mc.errorMsg = scoreboard_lv.errorMsg.toUpperCase();
- loading_mc.gotoAndStop(2);
- }
- }
- else
- {
- loading_mc.errorMsg = "COULD NOT ACCESS SCORES.";
- loading_mc.gotoAndStop(2);
- }
- switch(num)
- {
- case 2:
- worm_btn.enabled = python_btn.enabled = true;
- break;
- case 1:
- slug_btn.enabled = python_btn.enabled = true;
- break;
- default:
- slug_btn.enabled = worm_btn.enabled = true;
- }
- };
- score = 0;
- };
- back_btn.onPress = function()
- {
- page -= 5;
- if(page < 0)
- {
- page = 0;
- }
- if(page < 5)
- {
- back_btn._visible = false;
- }
- next_btn._visible = true;
- showScores();
- };
- next_btn.onPress = function()
- {
- page += 5;
- if(page > maxScore)
- {
- page = maxScore;
- }
- if(page > maxScore - 10)
- {
- next_btn._visible = false;
- }
- back_btn._visible = true;
- showScores();
- };
- newGame_btn.onRelease = function()
- {
- gotoAndStop(2);
- };
- slug_btn.onRollOver = function()
- {
- slug_mc._alpha = 100;
- };
- slug_btn.onRollOut = slug_btn.onDragOut = function()
- {
- slug_mc._alpha = 40;
- };
- slug_btn.onRelease = function()
- {
- loadScores(2);
- };
- worm_btn.onRollOver = function()
- {
- worm_mc._alpha = 100;
- };
- worm_btn.onRollOut = worm_btn.onDragOut = function()
- {
- worm_mc._alpha = 40;
- };
- worm_btn.onRelease = function()
- {
- loadScores(1);
- };
- python_btn.onRollOver = function()
- {
- python_mc._alpha = 100;
- };
- python_btn.onRollOut = python_btn.onDragOut = function()
- {
- python_mc._alpha = 40;
- };
- python_btn.onRelease = function()
- {
- loadScores(0);
- };
- loadScores(level);
-